angular.module('loading', [])
    .factory('loading', [
        '$ionicLoading', '$timeout',
        function($ionicLoading, $timeout) {
            var hide, prompt, show;
            show = function() {
                $ionicLoading.show({
                    template: '<ion-spinner icon="bubbles"></ion-spinner><br/>加载中...',
                    noBackdrop: true,
                    delay: 300
                });
            };
            hide = function() {
                $ionicLoading.hide();
            };
            prompt = function(template, time) {
                $ionicLoading.hide();
                time = time || 1000;
                $ionicLoading.show({
                    template: template,
                    noBackdrop: true,
                    duration: time
                });
            };
            return {
                show: show,
                hide: hide,
                prompt: prompt
            };
        }
    ]);
